package net.csdn.business.common.feign.search;


import net.csdn.business.common.constant.ServiceNameConstants;
import net.csdn.business.common.domain.PageDto;
import net.csdn.business.common.domain.query.IssuePageQuery;
import net.csdn.business.common.domain.query.IssueSearchQuery;
import net.csdn.business.common.domain.query.RepoSearchQuery;
import net.csdn.business.common.domain.query.discuss.DiscussSearchQuery;
import net.csdn.business.common.domain.vo.IssueItemVO;
import net.csdn.business.common.domain.vo.IssueSearchVO;
import net.csdn.business.common.domain.vo.RepoSearchVO;
import net.csdn.business.common.domain.vo.discuss.DiscussSearchVO;
import net.csdn.business.common.feign.search.config.SearchFeignConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


/**
 * @ClassName SearchFeignClient
 * @Description SearchFeign客户端
 * @Author zhangyl
 * @Date 2024/04/26 14:00
 */
@FeignClient(value = ServiceNameConstants.ATOMGIT_SEARCH_SERVICE, contextId = ServiceNameConstants.ATOMGIT_SEARCH_CONTEXT_ID, configuration = SearchFeignConfiguration.class)
public interface SearchFeignClient {

    /**
     * 讨论搜索
     */
    @PostMapping("/api/v1/search/discuss")
    public PageDto<DiscussSearchVO> discussSearch(@RequestBody @Validated DiscussSearchQuery query) throws Exception;

    /**
     * issue搜索
     */
    @PostMapping("/api/v1/search/issue")
    public PageDto<IssueSearchVO> issueSearch(@RequestBody @Validated IssueSearchQuery query) throws Exception;


    /**
     * 仓库搜索
     */
    @PostMapping("/api/v1/search/repo")
    public PageDto<RepoSearchVO> repoSearch(@RequestBody @Validated RepoSearchQuery query) throws Exception;


    /**
     * 根据仓库id搜索issue
     */
    @PostMapping("/api/v1/search/issue/project")
    public PageDto<IssueItemVO> searchByProject(@RequestBody @Validated IssuePageQuery query);
}